package com.dubbo.service;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.IOException;
import java.util.Scanner;

/**
 * @author Zhuyanfeng on 2018/3/20
 */

public class Main {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        ctx.refresh();
        ctx.start();
        Scanner scan = new Scanner(System.in);
        System.out.println("service started");
        Boolean wait = true;
        while (wait) {
            String result = scan.nextLine();
            while (!result.equals("stop")) {
                System.out.println("service continue");
                result = scan.nextLine();
            }
            System.out.println("are you sure stop services?");
            result = scan.nextLine();
            if (!result.equals("y")) {
                System.out.println("service continue");
                continue;
            }
            wait = false;
        }
        System.out.println("service end");
        ctx.close();
        scan.close();
    }
}
